<template>
  <!-- 下载中心页面 -->
  <div class="downloadBg">
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="fileName" label="文件名" width="250">

      </el-table-column>
      <el-table-column prop="url" label="地址" width="600">
      </el-table-column>
      <el-table-column prop="downloadTypeName" label="类型"> </el-table-column>
      <el-table-column prop="quantity" label="数据数量（条）">
      </el-table-column>
      <el-table-column prop="counts" label="备注"> </el-table-column>
      <el-table-column prop="createTime" label="请求时间"> </el-table-column>
      <el-table-column prop="operation" label="操作">
  <el-button style="background:green;color:white">未下载</el-button>
          <el-button  style="color:white">下载</el-button>
         </el-table-column>
    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="form.page"
      :page-size="form.pageSize"
         :page-sizes="[10, 20, 30, 40,50,60,70,80,90,100]"
              layout="sizes, prev, pager, next"
      :total="total"
    >
    </el-pagination>

    <!-- <el-pagination
              @current-change="handleCurrentChange"
              :current-page="form.page"
              :page-size="form.pageSize"
                 :page-sizes="[10, 20, 30, 40,50,60,70,80,90,100]"
              layout="sizes, prev, pager, next"
              :total="form.total">
            </el-pagination> -->
  </div>
</template>

<script>
import Format from '@/utils/format'
import { getDownload } from "@/services/model/download";
export default {
  data() {
    return {
      // 列表数据
      tableData: [],
      form: {
        page: 1,
        pageSize: 10,
      },
       total: 0,
       times:[]
    };
  },
    filters: {
    // 时间格式化
    formatTimer (timer) {
      return Format(new Date(timer), 'yyyy-MM-dd')
    },


  },
  methods: {
    // 下载列表请求数据
    async getList() {
      let res = await getDownload(
       this.form
      );
       this.tableData = res.data?.records || []
       // console.log(this.tableData)
      this.form.page = Number(res.data?.current)
      this.total = Number(res.data?.total)
    },
    // 分页大小改变
    handleSizeChange (val) {
      this.form.pageSize = val
      this. getList()
    },
    // 当前页码改变
    handleCurrentChange (val) {
      this.form.page = val
      this. getList()
    },
  },
  created() {
    this.getList();
  },
  activated() {
    this.getList();
  },
};
</script>

<style>
</style>
